package com.kevin.utility.common;

import javax.servlet.http.HttpServletRequest;

public class SendRedirectUtil {
	/**
	 * 获取本网站的基础目录地址
	 * @param rq
	 * @return
	 */
	public static String getWebBasePath(HttpServletRequest rq){
		String basePath = "";
		if(rq.getServerPort()>0){
			basePath = rq.getScheme() + "://" + rq.getServerName() + ":" + rq.getServerPort()
	    			+rq.getContextPath();
		}else{
			basePath = rq.getScheme() + "://" + rq.getServerName() + rq.getContextPath();
		}
		
		return basePath;
	}
}
